/*
 +----------------------------------------------------------------------
 + Title        : friend
 + Author       : huwl
 + Version      : 1.0.0
 + Initial-Time : 2023-03-11
 + Last-time    : 这个文件最后修改的时间 + 修改人的名称
 + Desc         : 好友接口
 +----------------------------------------------------------------------
*/

import type { BlacklistFriendParams, DisturbParams, EditFriendParams, FriendListParams, FriendListResult, FriendTotalResult, TopParams } from "@/types/friend"
import {http} from '@/utils/httpRequest'


/**
 * 添加,请求方式[POST]
 * 
 * @param number friend_id -------------------------------------请求参数
 * @returns any
 * @author huwl
 */
export const reqAddFriendAPI = (friend_id: number) => {
    return http({
        method: 'POST',
        url: 'friend/add',
        data: {friend_id}
    })
}

/**
 * 删除,请求方式[GET]
 * 
 * @param number friend_id -------------------------------------请求参数
 * @returns any
 * @author huwl
 */
export const reqDeleteFriendAPI = (ids: string) => {
    return http({
        method: 'GET',
        url: 'friend/delete',
        data: {ids}
    })
}

/**
 * 拉黑 + 取消拉黑好友,请求方式[POST]
 * 
 * @param BlacklistFriendParams data ---------------------------请求参数
 * @returns any
 * @author huwl
 */
export const reqBlacklistFriendAPI = (data: BlacklistFriendParams) => {
    return http({
        method: 'POST',
        url: 'friend/blacklist',
        data
    })
}

/**
 * 编辑,请求方式[POST]
 * 
 * @param EditFriendParams data --------------------------------请求参数
 * @returns any
 * @author huwl
 */
export const reqEditFriendAPI = (data: EditFriendParams) => {
    return http({
        method: 'POST',
        url: 'friend/edit',
        data
    })
}

/**
 * 详情,请求方式[GET]
 * 
 * @param number id --------------------------------------------请求参数
 * @returns any
 * @author huwl
 */
export const reqFriendDetailAPI = (id: number) => {
    return http<any>({
        method: 'GET',
        url: 'friend/detail',
        data: {id}
    })
}

/**
 * 列表,请求方式[GET]
 * 
 * @param FriendListParams data --------------------------------请求参数
 * @returns FriendListResult
 * @author huwl
 */
export const reqFriendListAPI = (data: FriendListParams) => {
    return http<FriendListResult>({
        method: 'GET',
        url: 'friend/list',
        data
    })
}

/**
 * 数量,请求方式[GET]
 * 
 * @param FriendListParams data --------------------------------请求参数
 * @returns FriendTotalResult
 * @author huwl
 */
export const reqFriendTotalAPI = (data: FriendListParams) => {
    return http<FriendTotalResult>({
        method: 'GET',
        url: 'friend/total',
        data
    })
}

/**
 * 免打扰,请求方式[GET]
 * 
 * @param DisturbParams data -----------------------------------请求参数
 * @returns any
 * @author huwl
 */
export const reqDisturbAPI = (data: DisturbParams) => {
    return http({
        method: 'GET',
        url: 'friend/disturb',
        data
    })
}

/**
 * 置顶,请求方式[GET]
 * 
 * @param TopParams data ---------------------------------------请求参数
 * @returns any
 * @author huwl
 */
export const reqTopAPI = (data: TopParams) => {
    return http({
        method: 'GET',
        url: 'friend/top',
        data
    })
}